package com.benew.ntt.player;

public class ObjectWrapper<T> {

    private T object;
    private boolean ready;

    public synchronized void set(T object) {
        this.object = object;
        this.ready = true;
        this.notifyAll();
    }


    public T get() {
        while (!this.ready) {
            synchronized (this) {
                try {
                    this.object.wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
        return this.object;
    }
}
